﻿#include "kongmingstart.h"
#include"kongming.h"
#include<QPainter>
#include<QPushButton>
#include"mypushbutton.h"
#include<QTimer>
#include<QMenuBar>
#include<QInputDialog>
#include<QDebug>
//孔明棋游戏介绍以及开始的界面
kongmingstart::kongmingstart(QWidget *parent) : QMainWindow(parent)
{
    //设置返回
    QMenuBar *bar = this->menuBar();
       this->setMenuBar(bar);
       QMenu * helpMenu = bar->addMenu("帮助");
       QAction *back = helpMenu->addAction("返回");//给菜单项下面再添加项目
       connect(back,&QAction::triggered,this,[=](){
           startFac=new start;

           this->hide();
           startFac->show();
       });
    //选择模式界面的配置
    this->setFixedSize(600,900);
    //设置图标
    this->setWindowIcon(QPixmap(":/pic/wolong.png"));
    //设置标题
    this->setWindowTitle("孔明棋");
    //设置开始游戏

    MyPushButton*kongmingstar=new MyPushButton(":/pic/Button1.png","开始游戏");
    kongmingstar->setParent(this);
    kongmingstar->move(0.5*this->width()-0.5*kongmingstar->width(),0.4*this->height());
    connect(kongmingstar,&MyPushButton::clicked,this,[=](){
        kongmingstar->zoom1();
        kongmingstar->zoom2();
        QTimer::singleShot(300,this,[=](){

//            // 输入对话框

              kongming*openkongming=new kongming;

             openkongming->show();
            this->close();


//             this->close();
        });

    });
    //设置游戏帮助  算了罢
//    QPushButton *help=new QPushButton("游戏帮助",this);
//    help->resize(120,50);
//    help->move(240,325);
//    //游戏帮助按钮跳转设置 待完善
//    connect(start,&QPushButton::clicked,this,[=](){
//        //kongming*openhelp=new kongming;
//        //openhelp->show();
//         this->close();
//    });
}
void kongmingstart::paintEvent(QPaintEvent *){
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/pic/tachibanakanade3.png");
    painter.drawPixmap(0,0,pix.width(),pix.height(),pix);
}

